package com.zs.test.mvpdemo.model;

import android.os.Handler;
import android.text.TextUtils;

import com.zs.test.mvpdemo.LoginListener;

/**
 * Created by zhangshuai on 17/3/14.
 */

public class LoginModelImpl implements LoginModel {
    @Override
    public void login(final String name, final String psd, final LoginListener listener) {

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                boolean error = false;
                if (TextUtils.isEmpty(name)){
                    listener.userNameError();
                    error = true;
                }

                if (TextUtils.isEmpty(psd)){
                    listener.passWordError();
                    error = true;
                }
                if (!error){
                    listener.loginSuccess();
                }


            }
        },2000);

    }

}
